﻿<%@page contentType="application/vnd.ms-excel;charset=UTF-8" %>
<%@ page language="java" import="com.base.myproject.client.jdbc.*" %>
<%@ page language="java" import="com.base.myproject.server.*" %>
<%@ page language="java" import="com.base.myproject.client.jdbc.DataSet" %>
<%@ page language="java" import="com.base.myproject.server.tools.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:x="urn:schemas-microsoft-com:office:excel"> 
<head>
<title></title>
<%
	response.setHeader("Content-disposition","attachment; filename=bank.xls");
	String upcode = request.getParameter("upcode");
	String sql = "select a.bname,hr_bankcard,salary from " +
			" bcode as a inner join " +
			" (select sum(amount)as salary,bcode from hr_salary where upcode='"+upcode+"' group by bcode) as b on a.bcode=b.bcode";
	DataSetTool DST = new DataSetTool();
	DataSet result = DST.getDataSet(sql);
	String sql2 = "select sum(amount) as total from hr_salary where upcode='"+upcode+"'";
	DataSet total = DST.getDataSet(sql2);
%>
</head>
<body>
	<table style="border-collapse: collapse" cellspacing="0" cellpadding="0" border="1"  bordercolordark="#CCCCCC" bordercolorlight="#CCCCCC" style="line-height: 120%;border-color:#000000;">
		<tr bgcolor="#e8e8e0" align="center">
			<td>编号</td><td>姓名</td><td>帐    号</td><td>金  额</td>
		</tr>
		<% for(int i = 0;i < result.getRowCount();i++){
		%>
			<tr align="center">
				<td><%=i + 1 %></td>
				<td><%=result.getValue(i,"bname") %></td>
				<td x:str><%=""+result.getValue(i,"hr_bankcard") == null ? "" : ""+result.getValue(i,"hr_bankcard")%></td>
				<td><%=result.getValue(i,"salary") == null ? "" : result.getValue(i,"salary")%></td>
			</tr>
		<%
		   }
		%>
		<tr align="center">
			<td></td>
			<td>总计</td>
			<td></td>
			<td><%=total.getValue(0,"total")%></td>
		</tr>
	</table>
</body>
</html>